<!DOCTYPE html>
<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
        <meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=0, minimum-scale=1.0, maximum-scale=1.0">
        <meta name="apple-mobile-web-app-capable" content="yes">
        <meta name="apple-mobile-web-app-status-bar-style" content="black">
        <title>{$goods.goods_name}_{$tpshop_config.shop_info_store_title}</title>
        <meta http-equiv="keywords" content="{$tpshop_config['shop_info_store_keyword']}" />
        <meta name="description" content="{$tpshop_config['shop_info_store_desc']}" />
        <link rel="stylesheet" type="text/css" href="__STATIC__/css/public.css"/>
        <link rel="stylesheet" type="text/css" href="__STATIC__/css/goods.css"/>

        <script type="text/javascript" src="__STATIC__/js/jquery.js"></script>
        <script type="text/javascript" src="__STATIC__/js/jweixin-1.0.0.js" ></script>
        <script src="__PUBLIC__/js/global.js"></script>
        <script src="__PUBLIC__/js/mobile_common.js"></script>
        <script src="__STATIC__/js/common.js"></script>

        <style type="text/css" media="all">
        
            .goods-intro{font-size:12px;line-height: 15px;color:#e94715;padding-left:10px;}
            .label-prom{font-size:12px;color:#fff;background: #dd2726;display: block;float: left;height: 20px;line-height: 20px;padding: 0px 4px;margin-top:4px;}
            .goods_price{width:100%;padding-left:10px;}
            .xiangq li{border:1px solid #ddd;border-top:0px;font-size:12px;color:#999;}
            .xiangq li:first-child{border-top:1px solid #ddd;}
            .xiangq li p{border-right:1px solid #ddd;padding:5px 8px;padding-right:15px;}
            .xiangq li span{padding:0px 10px;}
            .btn{font-size: 12px;background: #ff9c00;padding: 6px 2px;display: block;width: 90px;text-align: center;line-height: 20px;color: #fff;border-radius: 5px;}
            .product_info .info_dottm{display: flex;cursor: pointer;}

         

        </style>
    </head>
    <body >
        <div id="header">
          <div class="tab_nav">
            <div class="header">
              <div class="h-left"><a class="sb-back" href="javascript:history.back(-1)" title="返回"></a></div>
              <div class="h-mid" style="font-size:16px">宝贝详情</div>
              <div class="h-right">
                <aside class="top_bar">
                  <div onClick="show_menu();$('#close_btn').addClass('hid');" id="show_more"><a href="javascript:;"></a> </div>
                 </aside>
              </div>
            </div>
          </div>
        </div>
        <div id="wrapper">
            <div id="scroller">
                <ul id="thelist">
                    <div class="main" id="user_goods_ka_1" style="display:block;">
                    <div class="banner">
                      <div id="slider" class="slider" style="overflow: hidden; visibility: visible; list-style: none; position: relative;">
                        <ul id="sliderlist" class="sliderlist" style="position: relative; overflow: hidden; transition: left 600ms ease; -webkit-transition: left 600ms ease;">
                            <li style="float: left; display: block; width: 100%;"><span><a  href="javascript:void(0)">
                            <img title="" width="100%" src="{$goods.original_img}"></a></span></li>
                        </ul>
                        <div id="pagenavi">
                        <foreach  name="goods_images_list" item="pic" key="k">
                          <a href="javascript:void(0);" <if condition="$k eq 0">class="active"</if>></a>
                         </foreach>
                      </div>
                      </div>
                    </div>
                    <div class="s_bottom"></div>
                    <script type="text/javascript">
                    $(function(){
                      $("div.module_special .wrap .major ul.list li:last-child").addClass("remove_bottom_line");
                    });
                    var active=0,
                      as=document.getElementById('pagenavi').getElementsByTagName('a');

                    for(var i=0;i<as.length;i++){
                      (function(){
                        var j=i;
                        as[i].onclick=function(){
                          t2.slide(j);
                          return false;
                        }
                      })();
                    }
                    var t2=new TouchSlider({id:'sliderlist', speed:600, timeout:6000, before:function(index){
                        as[active].className='';
                        active=index;
                        as[active].className='active';
                      }});
                    </script>
                        <form name="buy_goods_form" method="post" id="buy_goods_form" >
                          <div class="product_info">
                            <div class="info_dottm">
                              <h3 class="name">{$goods.goods_name}</h3>
                             <!--  <span class="btn">加入分销</span> -->

                            </div>
                             <div class="goods-intro">{$goods.goods_remark}</div>
                             <if condition="$goods['shop_price'] neq $goods['exchange_integral']/$point_rate">
                            <dl class="goods_price">
                              <dt><span id="goods_price">￥{$goods['shop_price']-$goods['exchange_integral']/$point_rate}元</span> </dt>
                            </dl>
                            </if>
                            <ul class="price_dottm">
                              <li style=" text-align:left"><span class="lx1 jifen">{$goods['exchange_integral']}</span>积分</li>
                              
                              <li style=" text-align:right">{$goods.sale_num}人已兑换</li>
                            </ul>
                          </div>
 
                          <div style=" height:8px; background:#eeeeee; margin-top:-1px;"></div>
                          
                        </form>
                      </div>

                        <div class="main" id="user_goods_ka_2" style="display:block">
                          <div class="product_main"> 
                               <div class="product_images" id="product_desc" style="padding:10px;"> {$goods.goods_content|htmlspecialchars_decode} </div>
                          </div>
                        </div>
                </ul>
               
            </div>
        </div>

       <script>
       function goTop(){
        $('html,body').animate({'scrollTop':0},600);
       }
       </script> 
       <a href="javascript:goTop();" class="gotop" style="z-index:99999"><img src="__STATIC__/images/topup.png"></a>
       <div style=" height:60px;"></div>
       <div class="footer_nav">
         <ul style="width:60%">
           <li class="bian"><a href="{:U('Index/index')}"><em class="goods_nav1"></em><span>首页</span></a> </li>
           <li class="bian"><a href="javascript:void(0)" onclick="open_kefu()"><em class="goods_nav2"></em><span>客服</span></a> </li>
           <li><a href="javascript:collect_goods({$goods.goods_id});" id="favorite_add"><em class="goods_nav3"></em><span>收藏</span></a></li>
         </ul>
         <dl style="width:40%">
           <dd class="goumai" style="width:100%"><a style="display:block;" href="javascript:void(0);"  onclick="checkopint({$goods.goods_id});">立即兑换</a> </dd>
         </dl>
       </div>
       <script type="text/javascript" src="__PUBLIC__/static/js/layer/layer.js"></script>
       <script type="text/javascript">
     
       function open_kefu(){
         var url = "{:U('kefu/Webchat/index')}?user_id={$user.user_id}";
             layer.open({
                 type: 2,
                 title: '在线客服',
                 shadeClose: true,
                 shade: 0.8,
                 area: ['100%', '600px'],
                 content: url
             });
                $('body,html').height($(window).height()).css({
                 "overflow": "hidden"
             });

             var win_h= $(window).height();
             $('.layui-layer-iframe').height(win_h).css({'position':'fixed'});
             $('.layim-send-close,.layui-layer-close').click(function(){
               layer.closeAll();
               $("body").height('auto').css({
                       "overflow": "auto"
                 });
             })

           //connect(12);//连接用户
         
       }
       function checkopint(goods_id){
          layer.confirm('<p>总积分：{$pay_points}积分</p><p>消费积分：{$goods["exchange_integral"]}积分</p>', {
            btn: ['确认兑换','取消'] //按钮
          }, function(){
             $.post('{:U("User/consume_point")}',{goods_id:goods_id,points:'{$goods["exchange_integral"]}'},function(res){
                if(res=="success"){
                   layer.msg('兑换成功！');
                   setTimeout(function(){
                      addCard()
                   },1000)
                }
                if (res=="not_points") {
                   layer.msg('积分不够', {icon: 2});
                }
             })
            
          }, function(){
           
          });
       }

       </script>
       <script> 
        // 微信配置
        wx.config({
            debug: false,
            appId: "{$signPackage['appId']}", 
            timestamp: '{$signPackage["timestamp"]}', 
            nonceStr: '{$signPackage["nonceStr"]}', 
            signature: '{$signPackage["signature"]}',
            jsApiList: ['onMenuShareTimeline', 'onMenuShareAppMessage','onMenuShareQQ','onMenuShareQZone','hideOptionMenu','addCard'] 
        });

        function addCard(){
            wx.addCard({
              cardList: [
                {
                  cardId: 'p1UcYwfhl-LFmU9piKW-R5ISCdJY',
                  cardExt: '{"code":"","openid":"","nonce_str":"{$cardSign[nonce_str]}","timestamp": "{$cardSign[timestamp]}", "signature":"{$cardSign[sign]}"}'
                }
              ],
              success: function (res) {
                layer.msg('已添加到微信卡包', {icon: 1});
              },
              cancel: function (res) {
                layer.confirm('您确定要放弃领取优惠券吗？', {
                  btn: ['确认','取消'] //按钮
                }, function(){
                   layer.closeAll();
                }, function(){
                      addCard()
                });
              }
            });
        }
             
           
       </script>
     

    </body>
</html>